<?php
/**
 * Created by 张彪.
 * User: 小马出行
 * Date: 2018/1/16
 * Time: 16:57
 */
namespace app\inter\model;
use think\Db;
class DriverApplicationModel extends InterBase
{
    public function getApplication($map,$field='da.*',$flag=true,$page=1,$limit=10,$config='')
    {
        $config = $config?:$this->config;

        return $flag ? Db::connect($config)->name('driver_application da')
            ->join(['xm_driver_base'=>'b'],'da.driver_id=b.driver_id','LEFT')
            ->where($map)->field($field)->page($page,$limit)->select()
            : Db::connect($config)->name('driver_application da')
                ->join(['xm_driver_base'=>'b'],'da.driver_id=b.driver_id','LEFT')
                ->where($map)->field($field)->find();
    }

    public function addApplication($data)
    {
        return Db::table('inter_driver_application')->insertGetId($data);
    }

    public function updateApplication($map,$data)
    {
        return Db::table('inter_driver_application')->where($map)->update($data);
    }
}